import sympy as sp

# 定义变量
x = sp.symbols('x')

# 定义函数
f = x**2

# 计算导数
df = sp.diff(f,x)
print(f"导数: {df}")

# 计算不定积分
integral = sp.integrate(f,x)
print(f"不定积分: {integral}")

# 计算定积分
definite_integral_1 = sp.integrate(f,(x,0,1))
definite_integral_2 = sp.integrate(f,(x,0,2))
definite_integral_5 = sp.integrate(f,(x,0,5))
print(f"定积分: 0-1:{definite_integral_1}, 0-2:{definite_integral_2}, 0-5:{definite_integral_5}")

""" 
导数: 2*x
不定积分: x**3/3
定积分: 0-1:1/3, 0-2:8/3, 0-5:125/3
"""